package testUnitaire;

import java.io.File;
import java.io.IOException;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

public class ParserValidat {
	

	public static void main(String[] args){
		if (args.length<1){
			System.out.println("vous devez donner le fichier xsd ensuite ke fichier xml");
		}else{
			String xmlPath=args[0];
			System.out.println(xmlPath);
			//xmlPath="/home/ubuntu/Bureau/instance_express_MFHA_Example1.xml";
			SAXParserFactory factory= SAXParserFactory.newInstance();
			try {
				SAXParser parser= factory.newSAXParser();
				DefaultHandler dh=new DefaultHandler();
				File xmlFile=new File(xmlPath);
				parser.parse(xmlFile, dh);
			} catch (ParserConfigurationException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (SAXException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				System.out.println("erreur de parsing");
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
	

}
